package oldVersion.hifi;

/**
 *@author Adam
 */

import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Vector;

import org.farng.mp3.MP3File;
import org.farng.mp3.TagException;
import org.farng.mp3.id3.ID3v2_2;


public class Hifi{

	public String host = "";
	public int port = -1;
	public String serviceName = "";
	public static final String SERVICE_TYPE = "uss.local.";
	public TCPSocketHifi TCPSS;
	public String RMIServerIP = "";
	public RMIClient rmic = new RMIClient(this);

	public Hifi() {
	}
	
	
	public void setRMIServerIP(String s){
		RMIServerIP =s;
	}
	
	public void openRMI(){
		rmic.begin(RMIServerIP);
	}
	
	public void findServices(){
		BonjourListener sl = new BonjourListener(SERVICE_TYPE, this); //find the service
	}

	public void serviceDiscovered(String myHost, int myPort, String myServiceName){
		System.out.println("setting up for socket");
		this.host = myHost;
		this.port = myPort;
		serviceName = myServiceName;
		TCPSS = new TCPSocketHifi(host,port, this);
		String s = findRMIServer();
		TCPSS.sendMessage(s);
	}
	
	public void sendMessage(){
		
	}
	public String findRMIServer(){
		return "<RMIServer>where</RMIServer>";
	}
	
	public static void main(String[] args){
		Hifi ts = new Hifi();
		ts.findServices();
	}
}